package com.cat.yygh.oss.controller;

import com.cat.yygh.common.result.R;
import com.cat.yygh.oss.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Api(description="阿里云文件管理")
@RestController
@RequestMapping("/admin/oss/file")
public class OssController {
    @Autowired
    private FileService fileService;
    @PostMapping("/upload")
    public R upload(@ApiParam(name = "file", value = "文件", required = true)
        @RequestParam("file") MultipartFile file){
        String uploadUrl = fileService.upload(file);
        return R.ok().message("文件上传成功").data("url", uploadUrl);
    }
}
